<?php

namespace app\common\validate;
use think\Validate;
class Send extends Validate{
    protected $rule = [
        'account' => 'require|isMobile',
        
        'code' => 'require'
    ];

    protected $message = [
        'account.require' => '请输入手机号',
        'account.isMobile' => '请输入有效的手机号',
        
        'code.require' => '请输入手机验证码'
    ];

    protected $scene = [
        'send' => 'account,type', //发送验证码
        'check_code' => 'account,type,code', //验证码校验
        'bin_phone' => 'account,code', //绑定手机号
    ];
    //手机号验证
    protected function isMobile($mobile){
        if(!is_mobile($mobile)){
            return false;
        }
        return true;
    }
}